<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja" lang="ja">

<meta http-equiv="content-style-type" content="text/css">
<meta http-equiv="content-script-type" content="text/javascript">
<meta name="keywords" content="">
<meta name="description" content="">

<link href="css/default.css" rel="stylesheet" type="text/css" media="all">
<link href="css/style.css" rel="stylesheet" type="text/css" media="all">
<script type="text/javascript" src="js/jquery-1.7.1.js"></script>
	
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>今日のベルギービール / Today's Belgian Beer</title>
	</head>

	<body>
		<script type="text/javascript" src="js/qa.js"></script>
		
		<div><img src="images/check_header.jpg" alt="" style="cursor: auto; "></div>
		
		<div class="check bg">
		<div class="bd">
		<div class="aaa">
			
<?php

    /* Read input value */
    if (!isset($q1)) { $q1=$_POST['q1'] ; }
    if (!isset($q2)) { $q2=$_POST['q2'] ; }
    if (!isset($q3)) { $q3=$_POST['q3'] ; }
	
    $fp = fopen("data/test.csv","r");

    /* At this moment, algorithm of decision is just random */

    /* # of items */
    $num_of_items=0 ;
    while($data = fgetcsv($fp)) {
        $num_of_items++ ;
    }

    rewind($fp) ;

    /* Random value */
    $pos=mt_rand(1,$num_of_items) ;

    $idx=1;
    while($data = fgetcsv($fp)){
    	if ($pos <= $idx) {
            break ;
    	}
	$idx++ ;
    }
    fclose($fp);

    /* Load each value from csv */
    $base_filename=$data[1] ;
    $beer_name=$data[2] ;
    $beer_description=$data[3] ;

    print "<img src=\"data/$base_filename.jpg\" alt=\"AAA\" align=\"left\" width=\"180\" height=\"240\">" ;

    print "<center><h2>$beer_name</h2></center>" ;

    print "<br>" ;
    print "<div class=\"bbb\">" ;
    print "$beer_description" ;
    print "<br clear=\"left\" />" ;
    print "</div>" ;
?> 
	</div>		
	<div><img src="images/check_footer.jpg" alt="" style="cursor: auto; "></div>	     </form>
	</body>
</html>
